#-------------------------------------------------
# Project created by QtCreator 2015-08-01T00:00:11
#-------------------------------------------------

PRO_ROOT = $$PWD/../..

win32 {
    TARGET = $$qtLibraryTarget($${J_APP_NAME})
} else {
    TARGET = $${J_APP_NAME}
}

CONFIG -= app_bundle

###

macx:unix: {
    CONFIG += c++11
} else:win32:{

}

DESTDIR = $${PRO_ROOT}/bin

# - output - tmp -

macx:unix: {
    macx: {
        J_PLAT_PREFIX = macx
    } else: unix {
        J_PLAT_PREFIX = unix
    }

    PRO_TEMP_PREFIX = $${PRO_ROOT}/temp/examples/concurrent/$$J_APP_DIR/$$J_APP_NAME/$$J_PLAT_PREFIX
    MOC_DIR = $${PRO_TEMP_PREFIX}
    OBJECTS_DIR = $${PRO_TEMP_PREFIX}
    RCC_DIR = $${PRO_TEMP_PREFIX}
}

## - import libraries -

# jthreadpool

win32:CONFIG(release, debug|release): LIBS += -L$${PRO_ROOT}/lib/jthreadpool -ljthreadpool
else:win32:CONFIG(debug, debug|release): LIBS += -L$${PRO_ROOT}/lib/jthreadpool -ljthreadpoold
else:macx: LIBS += -framework jthreadpool -F$${FRAMEWORK_ROOT}/lib/
else:unix: LIBS += -L$${PRO_ROOT}/lib/jthreadpool -ljthreadpool

macx:{
    INCLUDEPATH += $${PRO_ROOT}/lib/jthreadpool.framework/Versions/Current/Headers
    DEPENDPATH += $${PRO_ROOT}/lib/jthreadpool.framework/Versions/Current/Headers
} else {
    INCLUDEPATH += $${PRO_ROOT}/lib/jthreadpool/include
    DEPENDPATH += $${PRO_ROOT}/lib/jthreadpool/include
}

# jconcurrent

win32:CONFIG(release, debug|release): LIBS += -L$${PRO_ROOT}/lib/jconcurrent -ljconcurrent
else:win32:CONFIG(debug, debug|release): LIBS += -L$${PRO_ROOT}/lib/jconcurrent -ljconcurrentd
else:macx: LIBS += -framework jconcurrent -F$${FRAMEWORK_ROOT}/lib/
else:unix: LIBS += -L$${PRO_ROOT}/lib/jconcurrent -ljconcurrent

macx:{
    INCLUDEPATH += $${PRO_ROOT}/lib/jconcurrent.framework/Versions/Current/Headers
    DEPENDPATH += $${PRO_ROOT}/lib/jconcurrent.framework/Versions/Current/Headers
} else {
    INCLUDEPATH += $${PRO_ROOT}/lib/jconcurrent/include
    DEPENDPATH += $${PRO_ROOT}/lib/jconcurrent/include
}

##

INCLUDEPATH += \
    $$PWD/../common

## copy libraries

copyCommand = @echo ---- module $${TARGET}: copy libraries ----

## lib-suffix
win32:CONFIG(debug, debug|release):lib_suffix=d

dstdir = $${PRO_ROOT}/bin
srcfiles =
macx: {
    ##
} else:win32|unix: {
    win32:dstdir = $$replace(dstdir, /, \\)
    # jthreadpool
    win32:target_name = jthreadpool$${lib_suffix}.dll
    else:unix:target_name = libjthreadpool$${lib_suffix}.so*
    srcfiles += $${PRO_ROOT}/lib/jthreadpool/$${target_name}
    ## copy files
    exists("$$srcfiles"): {
        win32:srcfiles = $$replace(srcfiles, /, \\)
        copyCommand += && $(COPY) "$$srcfiles" "$$dstdir"
    }
    # jconcurrent
    win32:target_name = jconcurrent$${lib_suffix}.dll
    else:unix:target_name = libjconcurrent$${lib_suffix}.so*
    srcfiles += $${PRO_ROOT}/lib/jconcurrent/$${target_name}
    ## copy files
    exists("$$srcfiles"): {
        win32:srcfiles = $$replace(srcfiles, /, \\)
        copyCommand += && $(COPY) "$$srcfiles" "$$dstdir"
    }
}

first.depends = $(first)
jconcurrent.commands = $$copyCommand
first.depends += jconcurrent

QMAKE_EXTRA_TARGETS += first \
    jconcurrent
